import com.zf.demo.Student;
import com.zf.demo.UserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class App2 {
    public static void main(String[] args) {
        //1、得到Spring 上下文对象
        BeanFactory context = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2、获取Bean
         UserService userService = (UserService) context.getBean("user");
         //3、使用Bean
        userService.func();
    }
}
